home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18389 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: ix.netcom.com!news
  2. From: giuliano@ix.netcom.com(Giuliano Carlini)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: NEED HELP WITH ABSOLUTE ADDRESSING
  5. Date: 19 Apr 1996 18:20:56 GMT
  6. Organization: Netcom
  7. Message-ID: <4l8li8$f5p@dfw-ixnews4.ix.netcom.com>
  8. References: <4l6gnp$38c@janus.cqu.edu.au>
  9. NNTP-Posting-Host: lbx-ca7-26.ix.netcom.com
  10. X-NETCOM-Date: Fri Apr 19  1:20:56 PM CDT 1996
  11.  
  12. In <4l6gnp$38c@janus.cqu.edu.au> Mutchg@Topaz.Cqu.Edu.Au (G.D.Mutch)
  13. writes: 
  14. >
  15. >Please !
  16. >Can Anyone tell me how to assign an absolute address to a variable,
  17. >or get the variable to point to 0x378 ?
  18.  
  19. Either:
  20.     long*   lptPortPtr = (long*)0x378;
  21.     long&   lptPortRef = *(long*)0x378;
  22.  
  23.     *lptPortPtr = 0;
  24.     lptPortRef = 0;
  25. Will associate lptPortPtr and lptPortRef with address 0x378. But, it
  26. may not be the lpt port. Under dos it will be. But, under Win16 or
  27. Win32 it won't be. It has to do with the x86 addressing; a book on the
  28. 386 architecture will explain why. Briefly, in "protected mode" the
  29. addresses your program works with are "linear" addresses. These are not
  30. the same as "physical" addresses. The real printer port is at physical
  31. address 0x386. To get to it, you'll need to do something more
  32. complicated. Under Win16, you can use DPMI to get the linear address
  33. for physical address 0x386, or possibly use one of the selector's which
  34. Win16 exports. Your best bet under Win3.x, Win95, or WinNT is to write
  35. a device driver.
  36.  
  37. g
  38.